<!--
 * @Description: 资源需求上报记录
 * @Author: JiangMing
 * @Date: 2021-09-8 9:40:00
 * @LastEditors: Lxc
 * @LastEditTime: 2021-09-13 17:07:33
-->
<template>
  <view class="page">
    <view v-for="(item,index) in list" :key="index" class="record-item">
      <view class="record-item__header">
        <view class="title">
          <image src="@/static/images/baozhang.png" class="icon" />
          <text class="text">保障点：{{ item.address }}</text>
        </view>
        <view>保障时间：{{ item.endTime }}</view>
      </view>
      <view class="record-item__content">
        <uni-table stripe emptyText="暂无更多数据" >
          <!-- 表头行 -->
          <uni-tr>
            <uni-th align="left" width="100px">资源</uni-th>
            <uni-th align="left" width="100px">物资规格</uni-th>
            <uni-th align="left">物资数量</uni-th>
            <uni-th align="left" width="100px">状态</uni-th>
          </uni-tr>
          <!-- 表格数据行 -->
          <uni-tr v-for="(item,i) in item.rows" :key="i">
            <uni-td>{{ item.name }}</uni-td>
            <uni-td>{{ item.size }}</uni-td>
            <uni-td>{{ item.value }}{{ item.unit }}</uni-td>
            <uni-td>
              <view v-if="status[item.state]" class="status">
                <image :src="status[item.state].icon" class="status-icon" />
                <text>{{ status[item.state].name }}</text>
              </view>
            </uni-td>
          </uni-tr>
        </uni-table>
      </view>
      <view class="record-item__footer">
        <text>上报时间：{{ item.reportTime }}</text>
        <text>上报人：{{ item.reportMan }}</text>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      list: [
        {
          address: '深圳市南山区红老街到66号',
          endTime: '2020-11-12 12:12:12',
          reportTime: '2020-11-12 12:12:12',
          reportMan: '张三',
          rows: [
            { name: '拖拉机', size: '1T', value: '2', unit: '台', state: 1 },
            { name: '救生衣', size: '均码', value: '200', unit: '件', state: 2 },
            { name: '千斤顶', size: '≥800KG', value: '2', unit: '个', state: 3 },
            { name: '手提式灭火器', size: '1KG', value: '22', unit: '个', state: 4 },
          ]
        },
        {
          address: '深圳市南山区红老街到66号',
          endTime: '2020-11-12 12:12:12',
          reportTime: '2020-11-12 12:12:12',
          reportMan: '张三',
          rows: [
            { name: '拖拉机', size: '1T', value: '2', unit: '台', state: 1 },
            { name: '救生衣', size: '均码', value: '200', unit: '件', state: 2 },
            { name: '千斤顶', size: '≥800KG', value: '2', unit: '个', state: 3 },
            { name: '手提式灭火器', size: '1KG', value: '22', unit: '个', state: 4 },
          ]
        }
      ],
      status: {
        1: { name: '未处理', icon: require('@/static/images/resource-wait.png') },
        2: { name: '调配中', icon: require('@/static/images/resource-start.png') },
        3: { name: '已完成', icon: require('@/static/images/resource-finish.png') },
        4: { name: '不处理', icon: require('@/static/images/resource-stop.png') },
      }
    }
  },
  onLoad(options) {
    this.eventId = options.eventId;
    this.getList();
  },
  methods: {
    getList() {

    }
  }
}
</script>

<style lang="scss" scoped>
.page {
  padding: 32rpx;
}
.record-item {
  background: #fff;
  border-radius: 16rpx;
  box-shadow: 0px 3px 15px rgba(44, 121, 247, 0.2);
  padding: 32rpx;
  margin-bottom: 32rpx;
  .record-item__header {
    color: #2B2B2B;
    font-size: 28rpx;
    line-height: 40rpx;
    margin-bottom: 30rpx;
    .title {
      color: #1D1F24;
      font-size: 30rpx;
      line-height: 40rpx;
      font-weight: bold;
      margin-bottom: 20rpx;
    }
    .icon {
      width: 30rpx;
      height: 30rpx;
      vertical-align: middle;
      margin-right: 10rpx;
    }
    .text {
      vertical-align: middle;
    }
  }
  .record-item__content {
    font-size: 26rpx;
    border: 1px solid #eff2f5;
    .status {
      white-space: nowrap;
    }
    .status-icon {
      width: 24rpx;
      height: 24rpx;
      margin-right: 10rpx;
    }
  }
  .record-item__footer {
    display: flex;
    justify-content: space-between;
    color: rgba(43, 43, 43, .6);
    font-size: 24rpx;
    line-height: 40rpx;
    margin-top: 40rpx;
  }
  ::v-deep .uni-table-th,
  ::v-deep .uni-table-td {
    font-size: 26rpx;
  }
}
</style>